package v1

import (
	"gitee.com/liangziyisheng/caas-platform-mc/internal/model/do"
	"gitee.com/liangziyisheng/caas-platform-mc/internal/model/entity"

	"github.com/gogf/gf/v2/frame/g"
)

type ListReq struct {
	g.Meta `path:"/permissions" tags:"权限管理" method:"get" summary:"权限列表"`
	MenuId int64 `json:"menuId" v:"required|min:1"`
}
type ListRes struct {
	g.Meta `mime:"application/json"`
	Data   []Pms `json:"data"`
	Total  int   `json:"total"`
}

type Pms struct {
	Id        int64  `json:"id"`
	Name      string `json:"name"`
	Path      string `json:"path"`
	Operation string `json:"operation"`
}

type AddReq struct {
	g.Meta    `path:"/permissions" tags:"权限管理" method:"post" summary:"添加权限"`
	MenuId    int64  `json:"menuId" v:"required|min:1"`
	Name      string `json:"name" v:"required"`
	Path      string `json:"path" v:"required"`
	Operation string `json:"operation" v:"required" description:"操作: 增POST删DELETE改PUT查GET"`
}
type AddRes struct {
	g.Meta `mime:"application/json"`
	Id     int64 `json:"id"`
}

type UpdateReq struct {
	g.Meta    `path:"/permissions/{id}" tags:"权限管理" method:"put" summary:"更新权限"`
	Id        int64  `json:"id"`
	Name      string `json:"name"`
	Path      string `json:"path"`
	Operation string `json:"operation"`
}
type UpdateRes struct {
	g.Meta `mime:"application/json"`
	Rows   int64 `json:"rows"`
}

type DeleteReq struct {
	g.Meta `path:"/permissions/{id}" tags:"权限管理" method:"delete" summary:"删除权限"`
	Id     int64 `query:"id" v:"required|min:1"`
}
type DeleteRes struct {
	g.Meta `mime:"application/json"`
	Rows   int64 `json:"rows"`
}

type InfoReq struct {
	g.Meta `path:"/permissions/{id}" tags:"权限管理" method:"get" summary:"权限详情"`
	Id     int64 `query:"id" v:"required|min:1"`
}

type InfoRes struct {
	g.Meta `mime:"application/json"`
}

// input and output struct
type ListInput struct {
	MenuId int64 `json:"menuId"      orm:"f_menu_id"     description:"菜单id"`
}
type ListOutput struct {
	Data  []entity.Permission `json:"data"`
	Total int                 `json:"total"`
}
type AddInput struct {
	do.Permission
}
type AddOutput struct {
	Id int64 `json:"id"`
}

type UpdateInput struct {
	do.Permission
}
type UpdateOutput struct {
	Rows int64 `json:"rows"`
}

type DeleteInput struct {
	Id int64 `json:"id"`
}
type DeleteOutput struct {
	Rows int64 `json:"rows"`
}
type InfoInput struct{}
type InfoOutput struct{}
